package publics.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


@Entity
@Table(name="admin")
public class Admin {//管理员
	
	private Integer id;// ID               int not null,
	private String user;// 管理员账户       varchar(20) not null,
	private String pass;// 密码             varchar(20) not null,
	private String name;// 姓名             varchar(4) not null,
	private Integer sex;    // 性别             int,
	private String post;// 职位             varchar(10),
	private String phone;//联系电话            varchar(12),
	private String email;//电子邮箱            varchar(40),
	
	private Right right; //权限等级的外键
//	private Integer level;  // 权限等级（默认）           int not null,
	
	@Id
	@GeneratedValue
	@Column(name="Ad_id")
	public Integer getId() {
		return id;
	}
	@Column(name="Ad_user")
	public String getUser() {
		return user;
	}
	@Column(name="Ad_pass")
	public String getPass() {
		return pass;
	}
	@Column(name="Ad_name")
	public String getName() {
		return name;
	}
	@Column(name="Ad_sex")
	public Integer getSex() {
		return sex;
	}
	@Column(name="Ad_post")
	public String getPost() {
		return post;
	}
	@Column(name="Ad_phone")
	public String getPhone() {
		return phone;
	}
	@Column(name="Ad_email")
	public String getEmail() {
		return email;
	}
/*	@Column(name="Ad_level")
	public Integer getLevel() {
		return level;
	}*/
	@ManyToOne
	@JoinColumn(name="Rig_id",nullable=false)
	public Right getRight() {
		return right;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public void setPass(String pass) {
		this.pass = pass;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	public void setPost(String post) {
		this.post = post;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public void setEmail(String email) {
		this.email = email;
	}
/*	public void setLevel(Integer level) {
		this.level = level;
	}*/
	public void setRight(Right right) {
		this.right = right;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Admin [email=" + email + ", id=" + id + ", name=" + name
				+ ", pass=" + pass + ", phone=" + phone + ", post=" + post
				+ ", right=" + right + ", sex=" + sex + ", user=" + user + "]";
	}

	
	
	
	
	

}
